<template>
  <div>
    ssss
    <!-- <el-dialog
      :title="!ruleForm.id ? '新增' : '修改'"
      :close-on-click-modal="false"
      :visible.sync="visible"
    >
      <el-form :model="Form" :rules="rules" ref="ruleForm" label-width="80px">
        <el-form-item label="添加类型" prop="addType">
          <el-input v-model="ruleForm.addType"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm('ruleForm')">确定</el-button>
          <el-button @click="resetForm('ruleForm')">重置</el-button>
          <el-button @click="quxiao()">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog> -->
  </div>
</template>
<script>
export default {
  name: "addType",
  data: function() {
    return {
      visible: false,
      ruleForm: {
        addType: ""
      },
      rules: {
        name: [
          { required: true, message: "请输入添加类型", trigger: "blur" },
          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        ]
      }
    }
  },
  methods: {
    init(id) {
      this.ruleForm.id = id || 0
      this.visible = true
      this.$nextTick(() => {})
    },
    submitForm(addType) {
      this.$refs[addType].validate(valid => {
        if (valid) {
          alert("submit!")
        } else {
          console.log("error submit!!")
          return false
        }
      })
    },
    resetForm(addType) {
      this.$refs[addType].resetFields()
    }
  }
}
</script>
